package com.liaowei.post.controller;

import com.liaowei.common.BaseResponse;
import com.liaowei.common.ResultUtils;
import com.liaowei.model.param.PostCommentStatusParam;
import com.liaowei.model.param.PostUserParam;
import com.liaowei.post.service.PostUserService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("users")
@RequiredArgsConstructor
public class PostUserController {

    private final PostUserService postUserService;


    // 根据id修改评论状态
    @PutMapping("comment/status")
    public BaseResponse<String> commentStatus(@RequestBody @Validated PostCommentStatusParam commentStatusParam) {
        return ResultUtils.success(postUserService.updateCommentStatus(commentStatusParam));
    }

    // 保存postUser
    @PostMapping
    public BaseResponse<String> savePostUser(@RequestBody @Validated PostUserParam postUserParam) {
        return ResultUtils.success(postUserService.savePostUser(postUserParam));
    }
}
